#include <iostream>
#include <string>

using std::string;
using std::cout;

class Solution {
public:
    bool isAnagram(string s, string t) {
        int record[26] = { 0 };
        // 记录s的字母个数
        for(auto &alpa : s)
        {
            ++ record[alpa - 'a']; 
        }

        // 记录t的字母个数
        for(auto &alpa : t)
        {
            -- record[alpa - 'a'];
        }

        for(auto & num : record)
        {
            if(num != 0) return false;
        }
        return true;
    }
};

int main(int argc, char const *argv[])
{
    
    Solution s;
    cout << s.isAnagram("hello","ooleh") << "\n";
    getchar();
    return 0;
}
